﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LotteryVote.Logic;
using LotteryVote.Entity;

namespace LotteryVote
{
    public partial class CommissionGroupViewer : System.Web.UI.Page
    {
        CommisionGroupFacade commGroupFacade = new CommisionGroupFacade();
        GamePlayWayFacade gpwFacade = new GamePlayWayFacade();
        CompanyTypeFacade comTypeFacade = new CompanyTypeFacade();
        public IList<CommissionGroupModel> CommissionGroupModelList { get; set; }
        public IList<GameType> GameTypeList { get; set; }
        public IList<CompanyTypeModel> CompanyTypeList { get; set; }
        protected void Page_Load(object sender, EventArgs e)
        {
            CommissionGroupModelList = commGroupFacade.GetCommissionGroupBySpecie(1);
            GameTypeList = gpwFacade.GetAllGameType();
            CompanyTypeList = comTypeFacade.GetAllType();
        }

        public ConcreteCommission GetComm(CommissionGroupModel model, CompanyTypeModel comType, GameType gameType)
        {
            return model.ConcreteCommissionList.Where(it => it.CompanyType.Id == comType.Id && it.GameType.GameId == gameType.GameId).FirstOrDefault()??new ConcreteCommission();
        }
    }
}